package org.bigdata.framework.admin.web.util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.beetl.core.GroupTemplate;
import org.beetl.core.Template;
import org.beetl.ext.web.WebRenderExt;

import com.xxl.conf.core.XxlConfClient;

public class GlobalExt implements WebRenderExt {

	static long version = System.currentTimeMillis();

	@Override
	public void modify(Template template, GroupTemplate arg1,
			HttpServletRequest arg2, HttpServletResponse arg3) {
		// TODO Auto-generated method stub
		// js,css 的版本编号
		template.binding("sysVersion", version);
		arg2.getSession().getAttribute("username");
		template.binding("username", arg2.getSession().getAttribute("username"));
		template.binding("sysTitle", XxlConfClient.get("dal.system.title", "知识服务开发平台"));
		template.binding("sysLogo", XxlConfClient.get("dal.system.logo", "")); 
		template.binding("sysInfo", XxlConfClient.get("dal.system.info", "")); 
		//上传文件地址
		template.binding("fileServer", XxlConfClient.get("dal.file.server", ""));
		template.binding("filePath",XxlConfClient.get("dal.file.path", ""));
		template.binding("xxljob","");
		int count = 0;
		Object sessionOne = arg2.getSession().getAttribute("kaptchaTime");
		if (sessionOne != null) {
			count = Integer.parseInt(String.valueOf(sessionOne));
		} else {
			arg2.getSession().setAttribute("kaptchaTime", 0);
		}
		template.binding("sessionKap", count);
	}

}
